package work03;

import java.util.Scanner;

    /**
     * @author ｙｕａｎｂｉｎｂｉｎｇ
     *  猜数字游戏
     */
    public class Task14 {
        public static void main(String[] args) {
                int randNumber=(int)(Math.random()*10)+1;
            System.out.println("随机数已生成！");
            System.out.println("----请输入您猜的数字：----");
            Scanner scanner = new Scanner(System.in);
            int x = scanner.nextInt();
            while(x!=randNumber){
                if (x>randNumber) {
                    System.out.println("sorry,您猜大了！");
                }else{
                    System.out.println("sorry,您猜小了！");
                }
                System.out.println("----请输入您猜的数字：----");
                x = scanner.nextInt();
            }
            System.out.println("恭喜您，猜对了！");
        }
    }

